from utils.window.window_manager import WindowManager
from utils.window.window_pyauto import WindowPyAuto
from utils.game.function.roles import RolesMonitor

class GameInfo:
    """游戏信息"""
    def __init__(self , hwnd :int):
        self.hwnd = hwnd
        window_manager = WindowManager(self.hwnd)
        self.window = window_manager.find_window(self.hwnd)
        self.window_pyauto = WindowPyAuto(self.hwnd)
        # 角色信息
        # 生命值    
        self.HP : int = 0
        # 魔法值
        self.MP : int = 0
        self.roles_monitor = RolesMonitor()

    def to_dict(self) -> dict:
        return {
            "hwnd": self.hwnd,
            "当前时代":"王者无双",

            # 装备信息
            "equipment":{
                "属性":{
                    # 战斗属性
                    "战斗属性": {
                        "攻击力":0,
                        "法术攻击":0,
                        "伤害强度":0,
                        "防御值":0,
                    },

                    # 基础属性
                    "基础属性": {
                        "力量":0,
                        "智力":0,
                        "敏捷":0,
                        "体质":0,
                        "精神":0,
                    },

                    # 战术属性
                    "战术属性": {
                        "暴击率":0,
                        "防御力":0,
                        "生命值":0,
                    }
                }
            },
            "roles":{
                "HP":self.HP,
                "MP":self.MP,
            }
        }
    
    def get_equipment_info(self):
        """获取装备信息"""
        pass
    
    async def update_roles_info(self):
        """更新角色信息"""
        self.HP = await self.roles_monitor.get_hp(self.window_pyauto)
        # 可以添加其他角色信息的更新
    
        